/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package da5221_lab1_2011;

/**
 *
 * @author user
 */
public class DiagonosArray {

    public int[] sortArray(int[] sort1stArray) {
        int temp;

        for (int i = 0; i < sort1stArray.length - 1; i++) {
            for (int j = i + 1; j < sort1stArray.length; j++) {
                if (sort1stArray[i] > sort1stArray[j]) {
                    temp = sort1stArray[i];
                    sort1stArray[i] = sort1stArray[j];
                    sort1stArray[j] = temp;

                }
            }
        }
        return sort1stArray;
    }

    public int findMin(int[] unSortedArray) {
        int minimum = unSortedArray[0];
        for (int i = 1; i < unSortedArray.length; i++) {
            if (unSortedArray[i] < minimum) {
                minimum = unSortedArray[i];
            }
        }
        return minimum;
    }

    public int countNumber(int[] array, int num) {
        int count = 0;
        for (int i = 0; i < array.length - 1; i++) {
            if (array[i] == num) {

                count++;
            }
        }

        return count;
    }
}
